package com.jtbd.service.impl;

import com.jtbd.dto.db.UserEmployeeInfo;
import com.jtbd.dto.http.UserEmployeeHttpDto;
import com.jtbd.service.EmployeeManagementService;
import com.jtbd.service.UserEmployeeService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class EmployeeManagementServiceImpl implements EmployeeManagementService {
    @Resource
    private UserEmployeeService userEmployeeService;

    @Override
    public Long addEmployee(UserEmployeeHttpDto info) {
        UserEmployeeInfo employeeInfo = UserEmployeeHttpDto.getUserEmployeeInfo(info);
        int added = userEmployeeService.addUserEmployee(employeeInfo);
        if (added > 0) {
            return employeeInfo.getUserEmployee().getId();
        }
        return null;
    }

    @Override
    public boolean deleteEmployee(Long employeeId) {
        return userEmployeeService.deleteUserEmployee(employeeId) > 0;
    }

    @Override
    public boolean updateEmployee(UserEmployeeHttpDto info) {
        return false;
    }

    @Override
    public UserEmployeeHttpDto getEmployeeInfo(Long eid) {
        return null;
    }
}
